package com.jwb.demo003;

import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ConfigurationClassPostProcessor;
import org.springframework.context.support.GenericApplicationContext;

@ComponentScan
public class Demo003Application {
    public static void main(String[] args){
        GenericApplicationContext context = new GenericApplicationContext();
        context.registerBean("demo003Application",Demo003Application.class);
        // 添加BeanFactory后处理器，帮助解析需要用到的注解
        context.registerBean(AutowiredAnnotationBeanPostProcessor.class);
        context.registerBean(ConfigurationClassPostProcessor.class);
        context.registerBean(CommonAnnotationBeanPostProcessor.class);
        // 刷新容器
        context.refresh();
        // 关闭容器，销毁bean
        context.close();
    }
}
